﻿
@{
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}

<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">角色管理</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" onclick="admin_add()" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                        <div class="am-form-group tpl-table-list-select">
                            <select data-am-selected="{btnSize: 'sm'}" style="display: none;">
                                <option value="option1">所有类别</option>
                                <option value="option2">IT业界</option>
                                <option value="option3">数码产品</option>
                                <option value="option3">笔记本电脑</option>
                                <option value="option3">平板电脑</option>
                                <option value="option3">只能手机</option>
                                <option value="option3">超极本</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" class="am-form-field ">
                            <span class="am-input-group-btn">
                                <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="button"></button>
                            </span>
                        </div>
                    </div>

                    <div class="am-u-sm-12">
                        <table class="am-table am-table-compact am-table-striped tpl-table-black " id="list">
                            <thead>
                                <tr>
                                    <th>
                                        <input type="checkbox" class="checkall" />
                                    </th>
                                    <th>ID</th>
                                    <th>角色名称</th>
                                    <th>说明</th>
                                    <th>创建时间</th>
                                    <th>创建人</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section script{

    <script type="text/javascript">

        $(function () {
            $('#list').dataTable({
                ajax: {
                    url: '@Url.Action("GetRoleList")',
                    type:'post'
                },
                processing: true,
                paging: false,
                searching: false,
                info: false,
                columns: [
                    {
                        "sClass": "text-center",
                        "data": "Id",
                        "render": function (data, type, full, meta) {
                            return '<input type="checkbox"  class="checkchild"  value="' + data + '" />';
                        },
                        "bSortable": false
                    },
                    { data: 'Id'},
                    { data: 'Name'},
                    {
                        data: 'Description', render: function (data, type, row, meta) {
                            return data;
                        }
                    },
                    {
                        data: 'CreateTime', render: function (data, type, row, meta) {
                            data.replace(/Date\([\d+]+\)/, function (a) { eval('d = new ' + a) });
                            return d.format("yyyy-MM-dd hh:mm:ss");
                        }
                    },
                    { data: 'CreatePerson'}
                ],
                drawCallback: function (settings) {
                    // 高亮显示当前行
                    $(settings.nTable).find("tbody tr").click(function (e) {
                        $(e.target).parents('table').find('tr').removeClass('warning');
                        $(e.target).parents('tr').addClass('warning');
                    });
                },
            });
        })

        function admin_add() {
            layer.msg("添加角色")
        }
    </script>
}